public with sharing class SetDailyRate {
	
	private void bla(){
		
		
		
		
		//List<OpportunityLineItem> olis = [SELECT Id,UnitPrice FROM OpportunityLineItem WHERE Total_Booked_Hours__c > 0.00];
		List<String> oliIdsFromTimeEntry = new List<String>();	
		List<TimeEntry__c> timeEntries = [SELECT Id, Daily_Rate__c,SystemModstamp,Opportunity_Product_ID__c FROM TimeEntry__c WHERE SystemModStamp <=: System.today() AND Opportunity_Product_ID__c != ''];
		Map<Id,Decimal> myMap = new Map<Id,Decimal>();
		
		for(TimeEntry__c te:timeEntries){
			oliIdsFromTimeEntry.add(te.Opportunity_Product_ID__c);
		}
		
		List<OpportunityLineItem> olis = [SELECT Id,UnitPrice FROM OpportunityLineItem WHERE Id IN: oliIdsFromTimeEntry];
		
		for(OpportunityLineItem oli: olis){
			myMap.put(oli.Id,oli.UnitPrice);
		}
		
		

		List<TimeEntry__c> updateTimeEntries = new List<TimeEntry__c>();
		for(TimeEntry__c te: timeEntries){
			te.Daily_Rate__c = myMap.get(te.Opportunity_Product_ID__c);
			updateTimeEntries.add(te);
		}
		
		update updateTimeEntries;
	}
	
	

}